package it.antonio.ilpizze.mock;

import it.antonio.ilpizze.aop.Invocation;

import java.util.ArrayList;
import java.util.List;

public class Progress {
	
	private static ThreadLocal<Boolean> verify = new ThreadLocal<Boolean>();
	private static ThreadLocal<Invocation> invocation = new ThreadLocal<Invocation>();
	private static ThreadLocal<List<ArgumentMatcher>> matchers = new ThreadLocal<List<ArgumentMatcher>>();
	
	static {
		matchers.set(new ArrayList<ArgumentMatcher>());
		verify.set(false);
	}
	
	public static void startStubbing(Invocation i){
		invocation.set(i);
	}
	
	public static void addMatcher(ArgumentMatcher am){
		matchers.get().add(am);
	}
	
	public static Invocation invocation(){
		return invocation.get();
	}
	public static List<ArgumentMatcher> matchers(){
		return matchers.get();
	}
	
	public static void stopStubbing(){
		matchers.set(new ArrayList<ArgumentMatcher>());
		invocation.remove();
	}

	public static void startVerifiy() {
		verify.set(true);
	}
	public static boolean isVerify(){
		return verify.get();
	}
	
	public static void stopVerifiy() {
		matchers.set(new ArrayList<ArgumentMatcher>());
		verify.set(false);
	}
}
